import { _decorator, Component, Node, Vec3 } from 'cc';
const { ccclass, property } = _decorator;

export class AStarGridTool {

    x:number = 0;
    y:number = 0;
    pos:Vec3 = Vec3.ZERO;
    worldPos:Vec3 = Vec3.ZERO;
    node:Node = null;
    isPrevent:boolean = false;

}

export enum AStarEnum{
    START,MOVE,END
}

export class AStarInfo{
    x:number = 0;
    y:number = 0;
    parent:AStarInfo = null;
    point:AStarGridTool = null;
    type:AStarEnum = null;
    //离起点距离
    g:number = 0;
    //离终点距离
    h:number = 0;
    //寻路消耗
    f:number = 0;
    public static toAStarInfo(astar:AStarGridTool,type?:AStarEnum){
        return Object.assign(new AStarInfo,{
            ...astar,point : astar,type
        })
    }
}
